import React from 'react';
import { createBrowserRouter, Navigate } from 'react-router-dom';
import Login from '../views/login/Login';
import Home from '../views/home/Home';
import Collect from '../views/activity/Collect';
import ActivityList from '../views/activity/ActivityList';
import DeviceList from '../views/device/DeviceList';
import UVPhoneModels from '../views/device/UVPhoneModels';
import ThemeTemplates from '../views/play/ThemeTemplates';
import AIPlayTemplates from '../views/play/AIPlayTemplates';
import Postcard from '../views/play/Postcard';
import EmojiTemplates from '../views/play/EmojiTemplates';
import GreenScreenTemplates from '../views/play/GreenScreenTemplates';
import TempUserList from '../views/user/TempUserList';
import TempUserActivity from '../views/user/TempUserActivity';
import Wallet from '../views/account/Wallet';
import AccountConfiguration from '../views/account/AccountConfiguration';
import LoginLog from '../views/system/LoginLog';
import OperationLog from '../views/system/OperationLog';
import RequireAuth from './require-auth';
import NormalLayout from '../layouts/normal/Layout';

const router = createBrowserRouter([
  {
    path: '/',
    element: (
      <RequireAuth>
        <NormalLayout />
      </RequireAuth>
    ),
    children: [
      { index: true, element: <Home /> },
      { path: 'activity/collect', element: <Collect /> },
      { path: 'activity/list', element: <ActivityList /> },
      { path: 'device/list', element: <DeviceList /> },
      { path: 'device/uv-models', element: <UVPhoneModels /> },
      { path: 'play/theme', element: <ThemeTemplates /> },
      { path: 'play/ai', element: <AIPlayTemplates /> },
      { path: 'play/postcard', element: <Postcard /> },
      { path: 'play/emoji', element: <EmojiTemplates /> },
      { path: 'play/green', element: <GreenScreenTemplates /> },
      { path: 'user/temp', element: <TempUserList /> },
      { path: 'user/temp-activity', element: <TempUserActivity /> },
      { path: 'account/wallet', element: <Wallet /> },
      { path: 'account/configuration', element: <AccountConfiguration /> },
      { path: 'system/login-log', element: <LoginLog /> },
      { path: 'system/operation-log', element: <OperationLog /> },
    ]
  },
  { path: '/login', element: <Login /> },
  { path: '*', element: <Navigate to="/" replace /> }
]);

export default router;